﻿using Jay.Sc2.Bof.Lib.State;

namespace Jay.Sc2.Bof.Lib.Action.Protoss
{
	public class ActionProduceCyberneticsCore : ActionProduceFromProbe
	{
		public static ActionProduceCyberneticsCore Instance = new ActionProduceCyberneticsCore();

		private ActionProduceCyberneticsCore() : base(50, 150, 0) { }

		public override ProtossState.ProtossBuilding GetBuilding(ProtossState state) { return state.CyberneticsCore; }
		public override string EventName { get { return "ActionSpawnCyberneticsCore"; } }
		public override bool HaveTechnology(IBuildOrder bo)
		{
			ProtossState state = bo.State as ProtossState;
			return state.Gateway.Count > 0 || state.WarpGate.Count > 0;
		}
		public override bool IsInvalid(IBuildOrder bo)
		{
			ProtossState state = bo.State as ProtossState;
			return base.IsInvalid(bo) || state.Gateway.Total + state.WarpGate.Total == 0;
		}

		private IAction[,] m_Requirements;
		public override IAction[,] Requirements
		{
			get
			{
				if (m_Requirements == null)
					m_Requirements = new IAction[,] { { ActionProduceGateway.Instance } };
				return m_Requirements;
			}
		}
	}
}
